package com.dzm.portal.listener;

import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.domain.Content;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 作者：Dzm
 * 时间：2024-09-10-11:52
 * 功能：
 */

@Component
//@RabbitListener(queues = "remove-content")
public class RemoveContentListener {
    @Autowired
    private RedisService redisService;

    @RabbitHandler
    public void remove(Long[] ids) {
        //删除缓存
        for (Long id : ids) {
            redisService.deleteCacheMapValue(CacheConstants.CONTENT_LIST, id + "");
        }
    }
}
